<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>PoDoFo FAQ</title>

	<style type="text/css">
	h1 {
		font-size: 140%;
	}
	h2 {
		font-variant: small-caps;
		font-size: 120%;
		padding-left: 0.5em;
	}
	ul p {
		font-variant: small-caps;
		font-weight: bold;
	}
	.question {
		font-style: italic;
		padding-left: 1.5em;
		font-size: 110%;
		font-weight: bold;
	}
	.answer {
		padding-left: 1.5em;
	}
	</style>
</head>
<body>
	<h1>PoDoFo FAQ</h1>

	<ul>
		<p><a href="#s_general">General</a></p>
		<ul>
			<li><a href="#q_platforms">What platforms are supported by PoDoFo?</a></li>
			<li><a href="#commercial">Can I use PoDoFo in my commercial application?</a></li>
			<li><a href="#q_language">What language is PoDoFo written in?</a></li>
			<li><a href="#q_stability">Does PoDoFo offer a stable API or ABI</a></li>
			<li><a href="#q_mailinglists">Does PoDoFo have a mailing list?</a></li>
			<li><a href="#q_contact">My question isn't answered here. Where do I go next?"</a></li>
		</ul>
		<p><a href="#s_otherlang">Other Programming Languages</a></p>
		<ul>
			<li><a href="#q_c">My program is written in C. Can I use PoDoFo?</a></li>
			<li><a href="#q_cwrap">Is there a C wrapper for PoDoFo?</a></li>
			<li><a href="#q_java">I'm a Java developer. Can I use PoDoFo?</a></li>
			<li><a href="#q_otherlang">Are any other languages supported?</a></li>
		</ul>
		<p><a href="#s_troubleshooting">Troubleshooting</a></p>
		<ul>
			<li><a href="#q_stdterminate">Sometimes my program crashes in a call to PoDoFo
	and produces a traceback including a call to
	<code>std::terminate()</code>. Why?</a></li>
			<li><a href="#q_sigabrt">Why does my program crash with a SIGABRT (Signal #6) in a call to PoDoFo?</a></li>
			<li><a href="#q_setlocale">PoDoFo creates invalid PDF files because <b>,</b> is used in floats instead of <b>.</b>?</a></li>

		</ul>
	</ul>

	<a name="s_general"><h2>General</h2></a>

	<a name="q_platforms"><p class="question">What platforms are supported by PoDoFo?</p></a>
	<p class="answer">PoDoFo has been tested on Linux, Mac OS X and
	Windows. It is developed in a way platform independent way so that
	porting to any other system should be no problem.</p>

	<a name="q_commercial"><p class="question">Can I use PoDoFo in my commercial application?</p></a>
	<div class="answer">
		<p>Yes, though you must follow the terms of the LGPL license
		for PoDoFo. The license permits you to use PoDoFo in any
		commercial application, though the LGTL obliges you to provide
		source to PoDoFo its self and any changes you made to it under
		the LGPL. That means that you may link code to PoDoFo that is
		not GPL or LGPL licensed so long as you follow the LGPL's
		rules. You need not fear "viral code" here - not unless you
		start copying chunks of podofo into your own application, of
		course. The inlining done by the compiler is considered
		"linking" for the purposes of the license and thus not an
		issue.</p>

		<p>The PoDoFo developers would be happy if you would credit
		them for using PoDoFo in your application, though this is not a
		license obligation.</p>
	</div>

	<a name="q_language"><p class="question">What language is PoDoFo written in?</p></a>
	<p class="answer">PoDoFo is written entirely in C++ . If you're interested in using it from other languages, see the
	section <a href="#s_otherlang">below</a>.</p>

	<a name="q_stability"><p class="question">Does PoDoFo offer a stable API or ABI?</p></a>
	<div class="answer">
		<p>PoDoFo is not presently able to provider either a stable API
		or ABI. The library is being developed quickly and still
		requires a lot of changes to its interfaces as it is enhanced.</p>

		<p>At present the best option for many users will be to target
		a snapshot of PoDoFo or a particular release. An in-tree copy of
		the library is not an unreasonable option, though care must be
		taken to ensure that your copy doesn't end up as an increasingly
		unmaintainable fork. The <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html">svn:externals</a> mechanism
		is probably ideal for projects that use svn, since it lets you specify
		a particular tag or revision that's versioned along with your project. See
		PoDoFoBrowser for an example of this.</p>

		<p>The README offers some more information on how to minimise the impact of
		API changes on your application.</p>

		<p>The PoDoFo developers are interested in offering a stable, maintained
		release at some point, but the library is not yet at a point where that is
		practical.</p>
	</div>

	<a name="q_mailinglists"><p class="question">Does PoDoFo have a mailing list?</p></a>
	<p class="answer">Yes. See our <a href="http://podofo.sourceforge.net/support.html">support</a> pages. You're very welcome on the lists,
	and they're not high traffic. If you have a question, make sure to tell us your compiler and version, platform / OS and version, PoDoFo version,
	where you got PoDoFo / how it was built, and the details of any error messages. If possible, upload a problem PDF somewhere that we can
	get to it, too.</p>

	<a name="q_contact"><p class="question">My question isn't answered here. Where do I go next?</p></a>
	<p class="answer">Your best bet is to email the <a href="http://podofo.sourceforge.net/support.html">podofo-users mailing list</a>.</p>

	<a name="s_otherlang"><h2>Other Programming Languages</h2></a>

	<a name="q_c"><p class="question">My program is written in C. Can I use PoDoFo?</p></a>
	<div class="answer">
		<p>PoDoFo can not be used directly from a basic C program, but if you have access to a C++ compiler there are acceptable workarounds.</p>

		<p>The cleanest approach is probably to write your PoDoFo-using
		code as C++ and have it expose a pure C interface (using
		<code>extern "C"</code> and the <code>nothrow()</code> qualifier) that can be used by
		the rest of your program/library/plugin. With proper care and
		attention to memory handling and exception safety in the code
		that works directly with podofo, this approach should work
		extremely well. You need to be careful not to allow exceptions
		to unroll past your interface functions and into their pure-C
		callers, and it's also necessary to be careful to use the C
		library memory allocator when allocating memory that'll be
		<code>free()</code>'d in your pure C code (or vice versa).</p>

		<p>As an alternative, if your program compiles as C++ (most C
		programs are legal C++), you may simply switch to building it
		with a C++ compiler. You may then use PoDoFo directly, though
		you'll still need to pay attention to cleaning up after an
		exception is thrown to avoid leaking resources or leaving your
		program in an invalid state. This is a reasonable approach for
		stand-alone programs, but is unattractive for library authors,
		plugin writers for C programs, and some other users.</p>
	</div>

	<a name="q_cwrap"><p class="question">Is there a C wrapper for PoDoFo?</p></a>
	<div class="answer">
		<p>Not as yet.</p>

		<p>As PoDoFo does not make heavy use of templates in its general public API, it would be possible to write a fairly full featured C wrapper around PoDoFo's public C++ APIs. Most of what'd be needed would be to:</p>

		<ul>
			<li>provide factory functions for PoDoFo objects</li>
			<li>provide deletion functions for PoDoFo objects</li>
			<li>write wrappers for methods that take an instance as
			their first argument (also expanding overloaded
			methods) and translate thrown exceptions into error
			codes.</li>
		</ul>

		<p>The PoDoFo authors would be interested in hearing about any such effort, but are not working on anything along those lines themselves.</p>
	</div>

	<a name="q_java"><p class="question">I'm a Java developer. Can I use PoDoFo?</p></a>
	<p class="answer">Not with Java, no, though we don't discriminate if
	you've used it but want to move to another language ;-) . In all
	seriousness a wrapper for Java may be possible, but nobody has been in
	touch with the PoDoFo developers to express an interest in writing
	one. Java users will probably want to look at <a href="http://sourceforge.net/project/showfiles.php?group_id=2435">iText</a>.</p>

	<a name="q_dotnet"><p class="question">I'm a C# or other .NET develiper. Can I use PoDoFo?</p></a>
	<p class="answer">Not easily. Since PoDoFo is unmanaged C++ code, you can use it with P/Invoke and a glue layer, but I wouldn't recommend
	this as a pleasant way to use a library. If writing your PDF output code in C++ is an option, you may well be able to use PoDoFo.</p>

	<a name="q_otherlang"><p class="question">Are any other languages supported?</p></a>
	<p class="answer">No. Python bindings would be a fun <a href=http://www.boost.org/libs/python/doc/">Boost::Python</a> project, though.</p>

	<a name="s_troubleshooting"><h2>Troubleshooting</h2></a>

	<a name="q_stdterminate"><p class="question">Sometimes my program crashes in a call to PoDoFo
	and produces a traceback including a call to
	<code>std::terminate()</code>. Why?</p></a>
	<div class="answer">
		<p>If you're seeing a traceback including a call to <code>std::terminate()</code>, 
		like the (simplified) one shown below, the problem is probably that you're
		not catching an exception being thrown by podofo.</p>

			<code>
			raise()<br/>
			abort ()<br/>
			std::set_unexpected ()<br/>
			<b>std::terminate</b> ()<br/>
			PoDoFo::SomePoDoFoMethod()<br/>
			main()<br/>
			</code>

		<p>PoDoFo uses exceptions to indicate error conditions to the
		caller, and your program is not handling an exception that is
		thrown by PoDoFo. Your program should call all PoDoFo methods
		that are not annotated `nothrow()' in a try/catch block, or be
		prepared to handle the exception further up the call chain.
		Code that calls PoDoFo should also be exception safe.</p>

		<p>In simplified terms, if you fail to catch an exception and
		allow it to unroll the stack past your main() function, the
		runtime will call <code>std::terminate()</code> for you. This
		in turn will call <code>abort()</code>. On Linux, a
		<code>SIGABRT</code> (Signal #6) will be generated and your
		program will be terminated. Windows users may be informed that
		their program has asked the runtime to terminate it in an
		unusual way, or may get a crash dialog.</p>
	</div>

	<a name="q_sigabrt"><p class="question">Why does my program crash with a SIGABRT (Signal #6) in a call to PoDoFo?</p></a>
	<p class="answer">You're probably not catching an exception being
	thrown by podofo. See the answer for std::terminate . Alternately, you
	might be hitting an internal assertion in PoDoFo, indicating you've
	found a library bug. If your problem isn't covered by the answer for
	std::terminate, please report a bug and include the full podofo library
	version, a backtrace of the crash (this is critical), the code that
	causes the crash if possible, the PDF that causes the crash if
	possible, and full information about your platform (OS/distro and
	version, what the CPU is, etc).</p>

	<a name="q_unusual_terminate"><p class="question">Why does my program exit with the message "Application has requested runtime to terminate it in an unusual way" ? </p>
	<p class="answer">This is the Windows equivalent of a crash on a signal. This could easily be an error in your code, or an error from PoDoFo
	crashing your program. You need to attach a debugger to find out. If you're using MinGW, install GDB from <a href="http://sourceforge.net/project/showfiles.php?group_id=2435">this page under "GNU Source Level Debugger"</a> then run <code>gdb --args myprogram.exe</code>. Visual Studio users should use the integrated debugger. If the crash does appear to come from PoDoFo, make sure that you are correctly catching and handling exceptions thrown by PoDoFo - see the answer to <code>std::terminate</code>.</p>


	<a name="q_setlocale"><p class="question">PoDoFo creates invalid PDF
	files because <b>,</b> is used in floats instead of <b>.</b>?</p></a>
	<p class="answer">PDF files use floating point numbers for almost all 
	drawing operations as coordinates. Those floating point numbers have to
	be written in the English format with a <b>.</b> (point) as a separator.
	Some languages like German use a <b>,</b> (comma) instead.<br/>
	Earlier versions of PoDoFo used the current locale's C++ library formatting
	operations to output values, causing these issues. Upgrade to a recent PoDoFo,
	or run in the `C' locale.</p>

	<a name="q_testsuites"><p class="question">Where can I get test PDF files?</p>
	<p class="answer">
		<ul>
		<li>Misc PDF test files
			<ul>
			<li><a href="http://acroeng.adobe.com/">Adobe - acroeng.adobe.com</a>. Mostly browser-plugin related, plus misc tests.</li>
			</ul>
		</li>
		<li>Colour and ICC:
			<ul>
			<li><a href="http://www.eci.org/doku.php?id=en:downloads#altona_test_suite">Altona test suite</a></li>
			<li><a href="http://www.gwg.org/ghentoutputsuite.phtml">Ghent Output Suite</a></li>
			</ul>
		</li>
		</ul>
	</p>

</body>
